<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>arrToString</title>
  <script>
    var a = [0,6,8,0,9,0]; 
    var arr = [];
    for (var i = 0; i < a.length; i++)
    {
      if (a[i] == 0)
        a.splice(i,1);

    }
    arr = a;
    console.log(arr);
    console.log(a);
  </script>
</head>
<body>
  
</body>
</html>